#pragma once

#include <stack>

#include "Singleton.h"
#include "WinMutex.h"
#include <SFML\Network.hpp>
#include <ostream>
#include <sstream>
#include <iostream>
#include "Packet.h"
#include "WinThread.h"
#include "GameState.h"
#include "Player.h"
#include "DataBase.h"

class NetworkController : public Singleton<NetworkController>
{
	friend class Singleton<NetworkController>;

private:
	NetworkController(void);
	~NetworkController(void);

	bool	connectSocket(std::string ip, int port);

	WinThread					m_networkLoop;
	
	bool							m_status;
	WinMutex					m_mutexStatus;

public:

	bool startService(std::string ip, int port);
	void stopService();

	void startGame(std::string);
	void refreshTime(std::string);
	void endGame(std::string);
	void refreshPlayers(std::string);
	void deadPlayer(std::string);
	void youAreDead(std::string);

	void						setStatus(bool);
	bool						getStatus();

	sf::TcpSocket				m_socket;
};